/*
 * Copyright (c)  2017
 * All rights reserved.
 * ProductInfo.java 2017-09-13 下午7:47
 */

package com.ueboot.weishop.entity.setting;

import com.ueboot.weishop.entity.IDEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;


/**
 * 描述:商品类别表
 *
 * @author yangkui create on 2017-09-13 下午7:47.
 * @since 1.0
 */
@Data
@NoArgsConstructor
@Entity(name = "WS_CATEGORY")
public class CategoryEntity extends IDEntity {
    public static final String GOODS_TYPE_VIRTUAL="虚拟";
    public static final String GOODS_TYPE_PHYSICAL="实物";
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "WS_CATEGORY")
    @GenericGenerator(name = "WS_CATEGORY", strategy = "enhanced-table", parameters = {
            @org.hibernate.annotations.Parameter(name = "table_name", value = "WS_TABLE_SEQUENCE"),
            @org.hibernate.annotations.Parameter(name = "segment_value", value = "WS_CATEGORY"),
            @org.hibernate.annotations.Parameter(name = "optimizer", value = "pooled") })
    @Column(name = "ID",columnDefinition = "INT(20) COMMENT 'id主键'",length = 20)
    private Long id;

    /**
     * 类目名称
     */
    @Column(name = "NAME",columnDefinition = "VARCHAR(200) COMMENT '类目名称'",length = 200)
    private String name;


    /**
     * 类目代码
     */
    @Column(name = "CODE",columnDefinition = "VARCHAR(200) COMMENT '类目代码'",length = 200)
    private String code;


    /**
     * 父级ID集合，使用/分割
     */
    @Column(name = "FULL_PATH_NAME",columnDefinition = "VARCHAR(200) COMMENT '父级ID集合，使用/分割'",length = 200)
    private String fullPathName;

    /**
     * 父级的全路径ID，使用/分割
     */
    @Column(name = "FULL_PATH_ID",columnDefinition = "VARCHAR(200) COMMENT '父级的全路径ID，使用/分割'",length = 200)
    private String fullPathId;

    /**
     * 商品类型：实物|虚拟物品
     * 针对实物需要进行配送服务，需要用户填写收货地址
     */
    @Column(name = "GOODS_TYPE",columnDefinition = "VARCHAR(200) COMMENT '商品类型：实物|虚拟物品'",length = 200)
    private String goodsType;
    /**
     * 父级类目，如果为空就是根级别的类目
     */
    @ManyToOne
    @JoinColumn(name="PARENT_ID",columnDefinition = "INT(20) COMMENT '父级类目，如果为空就是根级别的类目'")
    private CategoryEntity parent;
}